#include <GameEngine/Gameplay/Objects/object_base.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

#ifndef DOXYGEN_IGNORE
#include "object_base.moc"
#endif

//=================================================================================


GAMEENGINE_IMPLEMENT_RTTI(ObjectBase)

//! Default constructor
ObjectBase::ObjectBase() : name_(""), active_(true), id_(QUuid::createUuid()) {}

//! Copy constructor
/*!
 @param rhs The object to copy
 @note This function does NOT copy the ID to ensure its uniqueness
 */
ObjectBase::ObjectBase(const ObjectBase& rhs) : name_(rhs.name_), active_(rhs.active_), id_(QUuid::createUuid()) {}

//! Assignment operator
/*!
 @param rhs The object to copy
 @note This function does NOT copy the ID to ensure its uniqueness
 */
ObjectBase& ObjectBase::operator=(const ObjectBase& rhs) {
	if ( &rhs != this ) {
		name_ = rhs.name_;
		active_ = rhs.active_;
	}
	return *this;
}

//! Destructor
ObjectBase::~ObjectBase() {}

//! Change the name of the object
/*!
 @param name The new name of the object
 */
void ObjectBase::set_name(const GEString& name) {
	name_ = name;
}

//! Accessor to the name of the object
/*!
 @return A constant reference to the name of the object
 */
const GEString& ObjectBase::name() const {
	return name_;
}

//! Change the active state of the object
/*!
 @param active The state of the object
 */
void ObjectBase::set_active(bool active) {
	active_ = active;
}

//! Accessor to the state of the object
/*!
 @return The state of the object
 */
bool ObjectBase::active() const {
	return active_;
}

//! Accessor to the ID of the object
/*!
 @return A constant reference to the ID of the object
 */
const ObjectBase::ObjectID& ObjectBase::id() const {
	return id_;
}

//! Change the ID of the object
/*!
 @param id The new ID of the object
 @note The ID of an object must always be unique. Be sure not to mess up
       with this function in derived classes!
 */
void ObjectBase::set_id(const ObjectID& id) {
	id_ = id;
}

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif
